package com.yuezhu.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;

import com.yuezhu.global.BaseFragment;
import com.yuezhu.R;
import com.yuezhu.activity.AddTentenActivity;
import com.yuezhu.constomview.TentenView;
import com.yuezhu.constomview.TitleView;
import com.yuezhu.util.MyToast;

import butterknife.ButterKnife;
import butterknife.InjectView;

public class TentenFragmen extends BaseFragment implements View.OnClickListener, AdapterView.OnItemClickListener {

    @InjectView(R.id.title)
    TitleView title;
    @InjectView(R.id.tentenview)
    TentenView tentenview;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_tenten, container, false);
        ButterKnife.inject(this, view);
        initview(view);
        setLiseners();
        return view;
    }

    @Override
    public void initview(View view) {
        title.initTitleContent("", "资产", "", null).setStaus(TitleView.MID);
    }

    @Override
    public void setLiseners() {
        tentenview.setTentenViewClickListener(this, this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.add_apartment:
                Intent intent = new Intent(getActivity(), AddTentenActivity.class);
                startParallaxSwipeBackActivty(getActivity(), intent);
                break;
            case R.id.water_and_electricity:
                MyToast.showDefaltToast("水电录入");
                break;
            case R.id.signing:
                MyToast.showDefaltToast("签约");
                break;
            case R.id.announcement:
                MyToast.showDefaltToast("公告");
                break;
        }
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        MyToast.showDefaltToast(i + "");
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.reset(this);
    }
}
